/**
 * 删除附加物品接口
 */

//引入Q模块
var Q = require('q');
//引入公共函数
var util = require('../../util');

//delGoods接口入口文件
var index = function(getData, postData, config, _redis, db) {
	let deferred = Q.defer();
	if(postData.goodsId) {
		db.remove('attachGoods', {
			goodsId: postData.goodsId
		}).then(function() {
			deferred.resolve(1);
		}, function() {
			//删除附加物品失败
			deferred.reject('-0183');
		});
	}
	else {
		//删除附加物品接口参数不足
		deferred.reject('-0182');
	}
	return deferred.promise;
}

//暴露接口
module.exports = {
	index: index
}